'use strict'

class  shop{
  
  constructor () {

  }
  //得到商品列表
  async list (c) {
    console.log(c.query)
    let wuser = c.service.model.goods
    if(c.query.goodsid){
      let ulist = await wuser.sel(c.query.goodsid)
      c.send(ulist)
    }else if(c.query.keyword){
      let ulist = await wuser.select(c.query.keyword)
      c.send(ulist)
    }
    else{
      let ulist = await wuser.list()
      c.send(ulist)
    }
  }
  

}

module.exports = shop